<template>
  <div style="width:80%;margin:0 auto;padding-top:60px;">
      <div class="p-tb5">&nbsp;</div>
        <el-table
          style="width:100%"
          :max-height="slide_h"
          @header-contextmenu="showMenu"
          :empty-text="(data.data!=null&&data.data.length==0)?'空空如也':'数据初始化中...'"
          :data="data.data"
          ref="table"
          size="small"
          highlight-current-row
        >
          <el-table-column   width="60" label="序号">
            <template slot-scope="scope">
              {{scope.$index+1}}
            </template>
          </el-table-column>
          <el-table-column label="标题">
            <template slot-scope="scope">
              <el-button style="text-decoration: underline" class="c-f" size="mini" type="text" @click="openInfo(scope.row.id)">{{scope.row.title}}</el-button>
            </template>
          </el-table-column>
          <el-table-column   prop="descript" label="简介"/>
          <el-table-column   prop="author" label="发布人"/>
          <!--<el-table-column width="140" sortable prop="createTime" label="发布时间"/>-->
          <!--<el-table-column width="140" sortable prop="updateTime" label="更新时间"/>-->
        </el-table>
        <div class="first">
          <v-page v-if="pageinfo.pages!=null" :pageinfo='pageinfo' @changepageinfo="changepaginfo"/>
        </div>
    <!--<div>-->
      <!--<div v-for="(x,index) in 20" :key="index" style="height:50px;">1</div>-->
    <!--</div>-->
    </div>
</template>
<script>
  const pagination = () =>
    import ("@/components/pagination/pagetemplate")
  import tsearchtag from "@/components/search/template_tag_search"
  import tproper from "@/components/search/template_proper_search"
  export default {
    inject:["changeActive"],
    components: {
      "v-page": pagination,
      "vproper": tproper,
      "vsearchtag":tsearchtag
    },
    data() {
      return {
        data: "",
        slide_h:window.document.body.offsetHeight,
        loadingTxt: "",
        pageinfo: this.$store.getters.getPageInfo(this.$route.path,null),
      }
    },
    methods:{
      init() {
        this.$store.commit("saveLoadingMap",{"target":this.proAPI.URLS.findAllSysInformation,lock:1,text:this.loadingTxt});
        this.proAPI.getJson(this.proAPI.URLS.findAllSysInformation,this.proUtil.generateParams(this.pageinfo.params)).then((res) => {
          this.data = res;
          this.pageinfo.pages = res.pages;
          this.pageinfo.total = res.total;
        }).catch(()=>{
        })
      },
      changepaginfo() {
        this.$store.commit("savePageInfo",this.pageinfo);
        this.init();
      },
      changedialogshow() {
        this.dialogshow = 0;
      },
      toSearchFilter(){
        //需要初始化一下选中状态
        this.currentData = "";
        this.radio = "";
        this.pageinfo.params.page=1;
        this.init();
      },
      openInfo(id){
        if(id){
          var t={};
          t.id = id;
          var route = {
            path:'/info/information',	//路径
            name:'详情',	//配置路由时的name
            query:t
          }
          this.$router.push(route);
        }
      }
    },
    beforeCreate: function() {
    },
    created: function() {
    },
    beforeMount: function() {
    },
    mounted: function() {
      this.$nextTick(()=>{
        this.init();
        this.changeActive(3);
      })
    },
    beforeUpdate: function() {
    },
    updated: function() {
    },
    activated: function() {
    },
    deactivated: function() {
    },
    beforeDestroy: function() {
    },
    destroyed: function() {
      console.log("destroyed!!!")
    },
    errorCaptured: function(err, vm, info) {
    }
  }
</script>
<style scoped>
</style>
